#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

typedef struct TreeNode *Tree;
struct TreeNode
{
    int Element;
    Tree Left;
    Tree Right;
    bool flag;//if is visited
};
Tree NewNode(int input)
{
    Tree T = (Tree)malloc(sizeof(struct TreeNode));
    T->Left = NULL;
    T->Right = NULL;
    T->flag = false;
    T->Element = input;
    return T;
}
Tree Insert(Tree T,int input)
{
    if (T == NULL)//空树
        T = NewNode(input);
    else if(T->Element>input)//比根节点小 插入左子树
        T->Left = Insert(T->Left, input);
    else
        T->Right = Insert(T->Right, input);
    return T;
}
Tree MakeTree(int N)
{
    int input;
    Tree T = NULL;
    for(int i=0;i<N;i++)
    {
        scanf("%d", &input);
        T = Insert(T, input);
    }
        
    return T;
}
bool check(int input,Tree T)
{
    if(T == NULL)
        return false;
    if(!T->flag && input!=T->Element)
        return false;
    else if(!T->flag && input==T->Element)
    {
        T->flag = true;
        return true;
    }
    else if(input>T->Element)
        return check(input,T->Right);
    else
        return check(input,T->Left);
}
bool Judge(int N,Tree T)
{
    int new_input;
    bool is_false_now = false;
    for (int i = 0; i < N;i++)
    {
        scanf("%d", &new_input);
        if(!is_false_now && !check(new_input, T))
            is_false_now = true;
    }
    return !is_false_now;
}
void ResetT(Tree T)
{
    if(T->Left != NULL)
        ResetT(T->Left);
    if(T->Right != NULL)
        ResetT(T->Right);

    T->flag = false;
}
Tree FreeT(Tree T)
{
    if(T->Left !=NULL)
        FreeT(T->Left);
    if(T->Right != NULL)
        FreeT(T->Right);

    free(T);
    T = NULL;
    return T;
}
int main()
{
    int N, L;
    Tree T;

    scanf("%d", &N);
    
    while(N)
    {
        scanf("%d", &L);
        T = MakeTree(N);
        for (int i = 0; i < L;i++)
        {
            if(Judge(N,T))
                printf("Yes\n");
            else
                printf("No\n");
            ResetT(T);
        }
        T = FreeT(T);
        scanf("%d", &N);
    }
    return 0;
}